
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
		<meta content="yes" name="apple-mobile-web-app-capable" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection" />
		<meta content="emai=no" name="format-detection" />
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_HOST?>shared/css/shared.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_HOST?>gene/css/common.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_HOST?>gene/css/form.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_HOST?>gene/css/address.css" />
		<script type="text/javascript" src="<?php echo STATIC_HOST?>shared/js/zepto-1.1.6.js"></script>
		<script>
			Zepto(function ($) {
				function onBridgeReady() {
					WeixinJSBridge.call('hideOptionMenu');
				}

				if (typeof WeixinJSBridge == "undefined") {
					if (document.addEventListener) {
						document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
					} else if (document.attachEvent) {
						document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
						document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
					}
				} else {
					onBridgeReady();
				}
			});
		</script>
		<title>添加收货地址</title>
	</head>
	<body>
		<div class="wrapper form">
			<form action="/address/save" method="post">
				<input type="hidden" name="province_id" id="province_id" value="" data-message="请完善地址信息！"/>
				<input type="hidden" name="city_id" id="city_id" value="" data-message="请完善地址信息！"/>
				<input type="hidden" name="district_id" id="district_id" value="" data-message="请完善地址信息！"/>
				<input type="hidden" name="is_default" id="is_default" value="<?php if($count == 0):?>1<?php endif;?>"/>
				<section class="no-margin">
					<label>收货人：</label><input type="text" name="addressee" id="addressee" value="" data-message="请输入收货人！"/>
				</section>
				<section>
					<label>联系电话：</label><input type="tel" name="telephone" id="telephone" value="" data-message="请输入联系电话！"/>
				</section>
				<hr />
				<section data-href="javascript:zsmm.Popup.New($('.popup-addr'),0)" class="clear">
					<span class="s-right address-info"></span><label>所在地区：</label>
				</section>
				<hr />
				<section>
					<textarea rows="3" name="address" data-message="请完善地址信息！" id="address"><?php echo $row['address']?></textarea>
				</section>
				<hr />
				<section>
					<a class="isDefault <?php if($count == 0):?>active<?php endif;?>" type="radio" name="isDefault">默认地址</a>
				</section>
				<button type="submit" id="saveAddress" class="btn btn-orange">保存</button>
			</form>
		</div>
		<div class="hide popup-addr">
			<header class="clear">				
				<a id="done" class="s-right">完成</a>
				<a id="cancel">取消</a>
			</header>
			<section class="flex-wrapper flex-pack-justify">
				<select id="province" name="province" data-message="请完善地址信息！">
					<option>省</option>
					<?php foreach ($province as $item):?>
					<option value="<?php echo $item['id']?>"><?php echo $item['province_name']?></option>
					<?php endforeach;?>
				</select>
				<select id="city" name="city" data-message="请完善地址信息！">
				<option>市</option>
				</select>
				<select id="district" name="district" data-message="请完善地址信息！">
				<option>区</option>
				</select>
			</section>
		</div>
		<script type="text/javascript" src="<?php echo STATIC_HOST?>shared/js/shared.js"></script>
		<script type="text/javascript" src="<?php echo STATIC_HOST?>shared/js/form.js"></script>
		<script type="text/javascript" src="<?php echo STATIC_HOST?>gene/js/edit.js"></script>
		
	</body>
</html>
